package com.duing.util;

import nl.siegmann.epublib.domain.*;
import nl.siegmann.epublib.epub.EpubReader;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class EpubUtil {

    public static void main(String[] args) {

        File file = new File("epub/三体.epub");
        InputStream in = null;

        try {
            EpubReader reader = new EpubReader();
            in = new FileInputStream(file);
            Book book = reader.readEpub(in);

            Metadata metadata = book.getMetadata();
            System.out.println(metadata.getFirstTitle());
            System.out.println(metadata.getAuthors());

            Resources resources = book.getResources();
            System.out.println("资源个数为" + resources.size());

            Spine spine = book.getSpine();
            System.out.println("骨骼资源个数为" + spine.size());


        } catch (Exception e) {

        }

    }

}
